

*FIGURE 2: 

cd "$data"
use "data1.dta", replace

keep lrLabW* id pid* 
drop if id==.

foreach i in 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 20 21 22 23 {
	rename lrLabW`i' lrLabW_`i'
}	

reshape long lrLabW_, i(id) j(vague)

bysort vague: egen mean_LR_LAB = mean(lrLabW_) 

keep vague mean_LR_LAB
duplicates drop 


lab define wavedates 1 "Feb/Mar'14" 2 "May/Jun'14" 3 "Sept/Oct'14" 4 "Mar'15" 5 "Apr/May'15" 6 "May '15" ///
7 "Apr/May'16" 8 "May/Jun'16" 9 "Jun/Jul'16" 10 "Nov/Dec'16" 11 "Apr/May'17" 12 "May/Jun'17" 13 "Jun'17" ///
14 "May '18" 15"Mar/May'19" 16"May/Jun'19" 17"Nov'19" 18"Nov/Dec'19" 19"Dec'19" 20"Jun'20" 21"May'21" 22"Nov/Dec'21" 23"May'22"
	
		label values vague wavedates 	
		
tsset vague 
tsline mean_LR_LAB, lcolor(cranberry) xline(5, lpattern(dash)) xline(8.5, lpattern(dash)) xline(12, lpattern(dash)) xline(18, lpattern(dash)) tlabel(#30, labels labsize(vsmall) angle(vertical) valuelabel) graphregion(margin(5 5 20 10)) xtitle("") ytitle("left-right placement of Labour Party by the electorate", size(2.5))

graph save "${figures}/Figure2.gph", replace 
